package common.cell;

import common.Constants.*;

class Player extends Cell {
    override function init() {
        char = "@";
        color = COLOR_CYAN;
    }

    override public function update(key) {
        // Basic movement.
        if (key == KEY_UPLEFT) {
            move(x - 1, y - 1, z);
        } else if (key == KEY_UP) {
            move(x,     y - 1, z);
        } else if (key == KEY_UPRIGHT) {
            move(x + 1, y - 1, z);
        } else if (key == KEY_LEFT) {
            move(x - 1, y,     z);
        } else if (key == KEY_RIGHT) {
            move(x + 1, y,     z);
        } else if (key == KEY_DOWNLEFT) {
            move(x - 1, y + 1, z);
        } else if (key == KEY_DOWN) {
            move(x,     y + 1, z);
        } else if (key == KEY_DOWNRIGHT) {
            move(x + 1, y + 1, z);
        }
    }
}
